﻿using Prism.Mvvm;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.RightsManagement;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using ZuesControls.Models;

namespace ZuesUI.Models
{
    public class TreeViewModel : BindableBase,ITreeNode
    {
        public TreeViewModel()
        {

        }


        private ObservableCollection<TreeViewModel> _children = new ObservableCollection<TreeViewModel>();

        public ObservableCollection<TreeViewModel> Children
        {
            get { return _children; }
            set
            {
                SetProperty(ref _children, value);
            }
        }

        IList ITreeNode.Children => Children;

        private string _name;
        public string Name
        {
            get { return _name; }
            set
            {
                SetProperty(ref _name, value);
            }
        }

        private ImageSource _icon;
        public ImageSource Icon
        {
            get { return _icon; }
            set
            {
                SetProperty(ref _icon, value);
            }
        }

        private bool _isEditing = true;
        public bool IsEditing
        {
            get => _isEditing;
            set
            {
                if (_isEditing != value)
                {
                    SetProperty(ref _isEditing, value);
                }
            }
        }
        private bool _selected;
        public bool Selected
        {
            get => _selected;
            set
            {
               
              
                SetProperty(ref _selected, value);
                foreach (var item in this.Children)
                {
                    item.Selected = value;
                }
            }
        }
        private bool _isLast;
        public bool IsLast
        {
            get
            {
                return _isLast;
            }
            set
            {
                SetProperty(ref _isLast, value);
            }
        }

     

       

       public bool IsLastChild { get => _isLast; set { SetProperty(ref _isLast, value); IsLast = value; } }
    }
}
